﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;

namespace PloobsEngine.SceneControl
{
    public class HSVEffect : IPostEffect
    {
        public HSVEffect(Vector4 toAdd, Vector4 toMultiply)
        {
            this.toAdd = toAdd;
            this.toMultiply = toMultiply;
        }

        #region IPostEffect Members        
        private Effect noise;
        Vector4 toAdd;

        public Vector4 ToAdd
        {
            get { return toAdd; }
            set { toAdd = value; }
        }
        Vector4 toMultiply;

        public Vector4 ToMultiply
        {
            get { return toMultiply; }
            set { toMultiply = value; }
        }

        public void init(EngineStuff engine)
        {            
            this.noise = EngineStuff.CustomContentManager.GetAsset<Effect>("Effects//HSV");            
        }

        public void Draw(IRenderHelper rHelper, Microsoft.Xna.Framework.GameTime gt, Microsoft.Xna.Framework.Rectangle screenRec, IWorld world)
        {
           noise.Parameters["cena"].SetValue(rHelper[PrincipalConstants.CurrentImage]);
           noise.Parameters["toMultiply"].SetValue(toMultiply);
           noise.Parameters["toAdd"].SetValue(toAdd);                      
           rHelper.RenderTextureToFullScreenVertexPixel(noise);                  
        }

        #endregion
    }
}
